<!--

    Copyright © 2016-2024 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<section class="tb-widget-settings" [formGroup]="updateMultipleAttributesWidgetSettingsForm">
  <fieldset class="fields-group">
    <legend class="group-title" translate>widgets.input-widgets.general-settings</legend>
    <mat-form-field class="mat-block flex-1">
      <mat-label translate>widgets.input-widgets.widget-title</mat-label>
      <input matInput formControlName="widgetTitle">
    </mat-form-field>
    <mat-slide-toggle formControlName="showResultMessage" class="slide-block">
      {{ 'widgets.input-widgets.show-result-message' | translate }}
    </mat-slide-toggle>
  </fieldset>
  <fieldset class="fields-group fields-group-slider">
    <legend class="group-title" translate>widgets.input-widgets.action-buttons</legend>
    <mat-expansion-panel class="tb-settings" [expanded]="updateMultipleAttributesWidgetSettingsForm.get('showActionButtons').value">
      <mat-expansion-panel-header class="flex flex-row flex-wrap">
        <mat-panel-title>
          <mat-slide-toggle formControlName="showActionButtons" (click)="$event.stopPropagation()"
                            class="flex items-stretch justify-center">
            {{ 'widgets.input-widgets.show-action-buttons' | translate }}
          </mat-slide-toggle>
        </mat-panel-title>
        <mat-panel-description class="flex items-center justify-end xs:!hidden" translate>
          widget-config.advanced-settings
        </mat-panel-description>
      </mat-expansion-panel-header>
      <ng-template matExpansionPanelContent>
        <section class="flex flex-col">
          <mat-checkbox formControlName="updateAllValues" style="margin-bottom: 8px;">
            {{ 'widgets.input-widgets.update-all-values' | translate }}
          </mat-checkbox>
          <section class="flex flex-row xs:flex-col gt-xs:items-center gt-xs:justify-start gt-xs:gap-2">
            <mat-form-field class="mat-block flex-1">
              <mat-label translate>widgets.input-widgets.save-button-label</mat-label>
              <input matInput formControlName="saveButtonLabel">
            </mat-form-field>
            <mat-form-field class="mat-block flex-1">
              <mat-label translate>widgets.input-widgets.reset-button-label</mat-label>
              <input matInput formControlName="resetButtonLabel">
            </mat-form-field>
          </section>
        </section>
      </ng-template>
    </mat-expansion-panel>
  </fieldset>
  <fieldset class="fields-group">
    <legend class="group-title" translate>widgets.input-widgets.group-settings</legend>
    <section class="flex flex-col gap-2 gt-xs:flex-row gt-xs:items-center gt-xs:justify-start">
      <mat-slide-toggle formControlName="showGroupTitle" class="slide-block flex-full xs:max-h-30% gt-xs:max-w-30%">
        {{ 'widgets.input-widgets.show-group-title' | translate }}
      </mat-slide-toggle>
      <mat-form-field class="mat-block flex-full xs:max-h-70% gt-xs:max-w-70%">
        <mat-label translate>widgets.input-widgets.group-title</mat-label>
        <input matInput formControlName="groupTitle">
      </mat-form-field>
    </section>
  </fieldset>
  <fieldset class="fields-group">
    <legend class="group-title" translate>widgets.input-widgets.layout</legend>
    <section class="flex flex-col gt-xs:flex-row gt-xs:items-center gt-xs:justify-start gt-xs:gap-2">
      <mat-form-field class="mat-block flex-full xs:max-h-50% gt-xs:max-w-50%">
        <mat-label translate>widgets.input-widgets.fields-alignment</mat-label>
        <mat-select formControlName="fieldsAlignment">
          <mat-option [value]="'row'">
            {{ 'widgets.input-widgets.fields-alignment-row' | translate }}
          </mat-option>
          <mat-option [value]="'column'">
            {{ 'widgets.input-widgets.fields-alignment-column' | translate }}
          </mat-option>
        </mat-select>
      </mat-form-field>
      <mat-form-field [class.!hidden]="updateMultipleAttributesWidgetSettingsForm.get('fieldsAlignment').value !== 'row'" class="mat-block flex-full xs:max-h-50% gt-xs:max-w-50%">
        <mat-label translate>widgets.input-widgets.fields-in-row</mat-label>
        <input matInput type="number" min="1" step="1" formControlName="fieldsInRow">
      </mat-form-field>
    </section>
    <section class="flex flex-col gt-xs:flex-row gt-xs:items-center gt-xs:justify-start gt-xs:gap-2">
      <mat-form-field class="mat-block flex-full xs:max-h-50% gt-xs:max-w-50%">
        <mat-label translate>widgets.input-widgets.row-gap</mat-label>
        <input matInput type="number" min="0" step="1" formControlName="rowGap">
      </mat-form-field>
      <mat-form-field [class.!hidden]="updateMultipleAttributesWidgetSettingsForm.get('fieldsAlignment').value !== 'row'" class="mat-block flex-full xs:max-h-50% gt-xs:max-w-50%">
        <mat-label translate>widgets.input-widgets.column-gap</mat-label>
        <input matInput type="number" min="0" step="1" formControlName="columnGap">
      </mat-form-field>
    </section>
  </fieldset>
</section>
